import { MockMethod } from 'vite-plugin-mock';
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer';

const modules = import.meta.globEager('./**/*.ts');

const mockList: MockMethod[] = [];

for (const modulesKey in Object.keys(modules)) {
  if (!modulesKey.includes('/_')) mockList.push(...modules[modulesKey].default);
}

export const setupProdMockServer = () => {
  createProdMockServer(mockList);
};
